// 交易模块
const state = {
  selectedCoupon: {},
  selectedShipAddress: {},
  remark: ''
};

const mutations = {
  SET_TRADE_INFO: (state, payload) => {
    Object.keys(payload).forEach(key => {
      state[key] = payload[key];
    });
  },
  // 设置填写订单中备注
  setRemark(state, remark) {
    state.remark = remark;
  }
};

const actions = {
  setBaseInfo({ commit }, data) {
    commit('SET_TRADE_INFO', data);
  },
  setRemark({ commit }, data) {
    commit('setRemark', data);
  },
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
